
local SKIN = {}

SKIN.PrintName 		= "Dista Skin"
SKIN.Author 		= "CelSius"
SKIN.DermaVersion	= 1


// Variables //
	
	SKIN.fontCategoryHeader				= "Default"

	SKIN.bg_alt1 					= Color( 200, 235, 255, 128 )
	SKIN.bg_alt2 					= Color( 202, 220, 230, 128 )
	SKIN.bg_color 					= Color( 255, 222, 225, 128 )
	SKIN.bg_colozr_sleep 				= Color( 105, 111, 112, 128 )
	SKIN.bg_color_dark				= Color( 255, 255, 255, 64  )
	SKIN.bg_color_bright				= Color( 255, 255, 255, 64  )
	SKIN.colMenuBG					= Color( 100, 135, 155, 128 )
	SKIN.colMenuBorder				= Color( 255, 255, 255, 200 )
	SKIN.tooltip					= Color( 200, 235, 255, 255 )

	SKIN.listview_hover				= Color( 90, 220, 255, 255  )
	SKIN.colCollapsibleCategory			= Color( 255, 255, 255, 255 )	
	SKIN.colCategoryContent				= Color( 100, 135, 155, 255 )

	SKIN.shadow					= Color( 75, 130, 170, 128)
	SKIN.blur 					= Material( "pp/blurscreen" )
	SKIN.colPropertySheet 				= Color( 200, 235, 255, 128 )
	SKIN.colTab			 		= SKIN.colPropertySheet
	SKIN.colTabText		 			= Color( 0, 0, 0, 200       )
	SKIN.fontButton					= "DefaultSmall"
	SKIN.fontTab					= "DefaultSmall"
	SKIN.control_color				= Color( 240, 240, 240, 255 )
	SKIN.control_color2				= Color( 210, 210, 210, 255 )
	SKIN.control_color_highlight			= Color( 225, 240, 250, 255 )
	SKIN.control_color_highlight2			= Color( 180, 220, 240, 255 )
	SKIN.control_color_dark 			= Color( 200, 200, 200, 255 ) 
	SKIN.control_color_dark2 			= Color( 170, 170, 170, 255 )
	SKIN.control_glowoff				= Color( 0, 0, 0, 0 )
	SKIN.control_glow_highlight			= Color( 90, 220, 255, 175  )
	SKIN.control_glow_inactive			= Color( 45, 110, 128, 200  )
	SKIN.colTextEntryBorder				= Color( 45, 110, 128, 200  )

	SKIN.colTextEntryText				= Color( 45, 110, 128, 255  )
	SKIN.colTabText		 			= Color( 45, 110, 128, 255  )
	SKIN.colTabTextInactive				= Color( 25, 90, 108, 255   )
	SKIN.colButtonText				= Color( 45, 110, 128, 255  )
	SKIN.colButtonTextDisabled			= Color( 90, 220, 255, 255  )	
	SKIN.text_bright				= Color( 30, 90, 100, 255   )
	SKIN.text_normal				= Color( 45, 110, 128, 255  )
	SKIN.text_dark					= Color( 130, 190, 210, 255 )
	SKIN.text_highlight				= Color( 45, 110, 128, 255  )


// Draw Functions //

	function SKIN:DrawGradientRect( x, y, w, h, r, g, b, a, r2, g2, b2, a2 )
	
		for i=1, h do
		
		local gradient = (i / h)
		surface.SetDrawColor( (r*(1-gradient))+(r2*gradient), (g*(1-gradient))+(g2*gradient), (b*(1-gradient))+(b2*gradient), (a*(1-gradient))+(a2*gradient) )
		surface.DrawRect( x, y+i, w, 3 )
		
		end 
	end	

// Derma Functions //

				///////////
				// Frame //
				///////////

function SKIN:PaintFrame( panel )
		
		local shadow	= self.shadow
		local fill	= self.colPropertySheet
		local x, y 	= panel:GetPos( )
		local w, h 	= panel:GetSize( )
		
		self.blur:SetMaterialFloat( "$blur", 3 )
	// Blur
		surface.SetDrawColor( 255, 255, 255, 200 )
		surface.SetMaterial( self.blur )   
		surface.DrawTexturedRect( -x, -y, ScrW( ), ScrH( ) )
	
	
	// Shadow "Glow" 
		for i=0, 3 do
			
			surface.SetDrawColor( 0, 0, 0, 42.6*i )
			surface.DrawOutlinedRect( i, i, w+(i*2), h+(i*2) )
		end
	
	// Fill

		for i=0, math.Round(h/3) do
		
			local gradient = (i / (h/3))
			surface.SetDrawColor( 255-(55*gradient), 255-(20*gradient), 255, 230-(102*gradient) )
			surface.DrawRect( 0, i, w, 1 )
		
		end 

		surface.SetDrawColor( fill.r, fill.g, fill.b, fill.a )
		surface.DrawRect( 0, math.Round(h/3)+1, w, ((h/3)*2)-2 )

	// Inner Glow"
		for i=0, 10 do
			
			surface.SetDrawColor( shadow.r, shadow.g, shadow.b, shadow.a/i )
			surface.DrawOutlinedRect( i, i, w-(i*2), h-(i*2) )
		end

	// Outline

			surface.SetDrawColor( 255, 255, 255, 170 )
			surface.DrawOutlinedRect( 0, 0, w, h )

	// Title Shadow
		surface.SetDrawColor( 255, 255, 255, 128 )
		surface.DrawRect( 0, 20, w, 1 )
		surface.SetDrawColor( 0, 0, 0, 128 )
		surface.DrawRect( 0, 21, w, 1 )
end



function SKIN:DrawGenericBackground( x, y, w, h, color )
 
		local shadow	= self.shadow
		local fill	= self.colPropertySheet
	
	// Shadow "Glow" 
		for i=0, 8 do
			
			surface.SetDrawColor( 0, 0, 0, 16*(8-i) )
			surface.DrawOutlinedRect( -i, -i, w+(i*2), h+(i*2) )
		end
	
	// Fill

		for i=1, math.Round(h/3) do
		
			local gradient = (i / (h/3))
			surface.SetDrawColor( 255-(55*gradient), 255-(20*gradient), 255, 230-(102*gradient) )
			surface.DrawRect( 0, i, w, 1 )
		
		end 

		surface.SetDrawColor( fill.r, fill.g, fill.b, fill.a )
		surface.DrawRect( 0, (h/3)+1, w, ((h/3)*2)-2 )

	// Inner Glow"
		for i=0, 10 do
			
			surface.SetDrawColor( shadow.r, shadow.g, shadow.b, shadow.a/i )
			surface.DrawOutlinedRect( i, i, w-(i*2), h-(i*2) )
		end

	// Outline

			surface.SetDrawColor( 255, 255, 255, 170 )
			surface.DrawOutlinedRect( 1, 1, w-2, h-2 )
			surface.SetDrawColor( 0, 0, 0, 50 )
			surface.DrawOutlinedRect( 0, 0, w, h )

end




function SKIN:PaintForm( panel )

		local shadow	= self.shadow
		local fill	= self.colPropertySheet	
		local x, y 	= panel:GetPos( )
		local w, h 	= panel:GetSize( )

	// Shadow "Glow" 
		for i=0, 3 do
			
			surface.SetDrawColor( 0, 0, 0, 42.6*i )
			surface.DrawOutlinedRect( i, i, w+(i*2), h+(i*2) )
		end

	
	// Fill

		for i=1, h/3 do
		
			local gradient = (i / (h/3))
			surface.SetDrawColor( 255-(55*gradient), 255-(20*gradient), 255, 230-(102*gradient) )
			surface.DrawRect( 0, i, w, 1 )
		
		end 

		surface.SetDrawColor( fill.r, fill.g, fill.b, fill.a )
		surface.DrawRect( 0, (h/3)+1, w, ((h/3)*2)-2 )	

	// Inner Glow"
		for i=0, 10 do
			
			surface.SetDrawColor( shadow.r, shadow.g, shadow.b, shadow.a/i )
			surface.DrawOutlinedRect( i, i, w-(i*2), h-(i*2) )
		end

	// Outline

			surface.SetDrawColor( 255, 255, 255, 170 )
			surface.DrawOutlinedRect( 0, 0, w, h )


end

				//////////
				//Button//
				//////////

function SKIN:PaintButton( panel )

	local w, h 	= panel:GetSize()
	local x, y = panel:GetPos()

	if ( panel.m_bBackground ) then

		local outline	 = self.shadow
		local col	 = self.control_color
		local col2	 = self.control_color2
		local glow	 = self.control_glowoff

		if ( panel:GetDisabled() ) then

			col = self.control_color_dark
			col2 = self.control_color_dark2
			glow = self.control_glow_inactive

		elseif ( panel.Depressed || panel:GetSelected() ) then

			col = self.control_color_dark2
			col2 = self.control_color_dark
			glow = self.control_glow_inactive

		elseif ( panel.Hovered ) then

			col = self.control_color_highlight
			col2 = self.control_color_highlight2
			glow = self.control_glow_highlight
		end
		
		surface.SetDrawColor( col.r, col.g, col.b, col.a )
		surface.DrawRect( 0, 0, w, (h/5)*2)
		surface.SetDrawColor( col2.r, col2.g, col2.b, col2.a )
		surface.DrawRect( 0, (h/5)*2, w, (h/5)*3)
		
		for i=0, 5 do

			surface.SetDrawColor( glow.r, glow.g, glow.b, glow.a/i )
			surface.DrawOutlinedRect( i, i, w-(i*2), h-(i*2) )
		end
		
		surface.SetDrawColor( outline.r, outline.g, outline.b, 255 )
		surface.DrawOutlinedRect( 0, 0, w, h)
	end

end

function SKIN:PaintOverButton( panel )
end
	
				//////////
				// Tabs //
				//////////

function SKIN:PaintTab( panel )

local w, h	= panel:GetSize()

draw.RoundedBox( 4, 0, 0, w, h + 8, self.colTabShadow )

	
	
	if ( panel:GetPropertySheet():GetActiveTab() == panel ) then
		
		local col	 = self.control_color
		local col2	 = self.control_color2

		surface.SetDrawColor( col.r, col.g, col.b, col.a )
		surface.DrawRect( 0, 0, w, (h/5)*2)
		surface.SetDrawColor( col2.r, col2.g, col2.b, col2.a )
		surface.DrawRect( 0, (h/5)*2, w, (h/5)*3)
		
		for i=1, h do
			local grad	= (i/h) * 255
			surface.SetDrawColor( 0, 0, 0, grad )
			surface.DrawRect( 0, i, 1, 1)
			surface.DrawRect( w-1, i, 1, 1)
		end

	else

		col = self.control_color_dark
		col2 = self.control_color_dark2


		surface.SetDrawColor( col.r, col.g, col.b, col.a )
		surface.DrawRect( 0, 0, w, (h/5)*2)
		surface.SetDrawColor( col2.r, col2.g, col2.b, col2.a )
		surface.DrawRect( 0, (h/5)*2, w, (h/5)*3)
		surface.SetDrawColor( 0, 0, 0, 255 )
		surface.DrawOutlinedRect( 0, h-1, w, 1)
	end
	
end

				//////////////
				// Category //
				//////////////

function SKIN:PaintCollapsibleCategory( panel )

	local x, y = panel:GetPos()
	local w, h = panel:GetSize()


	local outline	 = self.shadow
	local fill	= self.colPropertySheet
	headcol = self.control_color_highlight
	headcol2 = self.control_color_highlight2
	glow = self.control_glow_highlight


	
		surface.SetDrawColor( headcol.r, headcol.g, headcol.b, headcol.a )
		surface.DrawRect( 0, 0, w, 8)
		surface.SetDrawColor( headcol2.r, headcol2.g, headcol2.b, headcol2.a )
		surface.DrawRect( 0, 8, w, 12)


	for i=1, h/3 do
		
		local gradient = (i / (h/3))
		surface.SetDrawColor( 255-(55*gradient), 255-(20*gradient), 255, 230-(102*gradient) )
		surface.DrawRect( 0, i, w, 1 )
	
	end 

	surface.SetDrawColor( fill.r, fill.g, fill.b, fill.a )
	surface.DrawRect( 0, (h/3)+1, w, ((h/3)*2)-2 )

	// Header Glow //

	for i=0, 8 do

		surface.SetDrawColor( glow.r, glow.g, glow.b, glow.a/i )
		surface.DrawOutlinedRect( i, i, w-(i*2), 20-(i*2) )
	end
		

		surface.SetDrawColor( outline.r, outline.g, outline.b, 255 )
		surface.DrawOutlinedRect( 0, 0, w, h)
	
end

				///////////
				// Label //
				///////////

function SKIN:SchemeLabel( panel )

	local col = nil

	if ( panel.Hovered && panel:GetTextColorHovered() ) then

		col = Color( 90, 220, 255, 255 )
	else
		col = Color( 45, 110, 128, 255 )
	end
	
	if ( col ) then
		panel:SetFGColor( col.r, col.g, col.b, col.a )
	else
		panel:SetFGColor( 45, 110, 128, 255 )
	end

end

function SKIN:SchemeForm( panel )

	panel.Label:SetFont( "TabLarge" )
	panel.Label:SetTextColor( Color( 45, 110, 128, 255 ) )

end

				///////////////
				// List line //
				///////////////

function SKIN:PaintListViewLine( panel )

	local w, h	 = panel:GetSize()
	local x, y 	 = panel:GetPos()
	
	local outline	 = self.shadow
	local col	 = self.control_color2
	local glow	 = self.control_glowoff
	
	if ( panel:IsSelected() ) then
	
		col = self.control_color2
		glow = self.control_glow_highlight
		
	elseif ( panel.Hovered ) then
	
		col = self.control_color
		glow = self.control_glow_highlight
		
	else
	end
		
	surface.SetDrawColor( col.r, col.g, col.b, col.a )
	surface.DrawRect( 0, 0, w, h )
		
	for i=0, 5 do

		surface.SetDrawColor( glow.r, glow.g, glow.b, glow.a/i )
		surface.DrawOutlinedRect( 0, i, w, 1 )
		surface.DrawOutlinedRect( 0, (h-i), w, 1 )

		if ( panel:IsSelected() ) then

			surface.SetDrawColor( 255, 255, 255, 128/i )
			surface.DrawOutlinedRect( 0, h-i, w, 1 )

		else

			surface.SetDrawColor( 255, 255, 255, 128/i )
			surface.DrawOutlinedRect( 0, i, w, 1 )

		end
	end
	
	surface.SetDrawColor ( outline.r, outline.g, outline.b, 255 )
	surface.DrawOutlinedRect( 0, h, w, 1 )
	
end

function SKIN:LayoutListViewLabel( panel )

	panel:SetTextInset( 10 )
	
	if ( panel.Line:IsSelected() ) then
		panel:SetTextColor( self.text_normal )
	else
		panel:SetTextColor( 255, 255, 255, 255 )
	end
		
end

function SKIN:SchemeMenuOption( panel )

	panel:SetFGColor( 200, 235, 255, 255 )
	
end

				///////////////
				// Numslider //
				///////////////

function SKIN:PaintNumSlider( panel )

	local w, h = panel:GetSize()
	
	self:DrawGenericBackground( 0, 0, w, h, Color( 255, 255, 255, 20 ) )
	
	surface.SetDrawColor( 0, 0, 0, 200 )
	surface.DrawRect( 3, h/2, w-6, 1 )
	
end

				/////////////
				// Tooltip //
				/////////////

function SKIN:PaintTooltip( panel )

	local w, h = panel:GetSize()
	
	DisableClipping( true )

	self:DrawGenericBackground( 0, 0, w, h, self.tooltip )
	panel:DrawArrow( 0, 0 )

	DisableClipping( false )
end
				///////////////
				// Scrollbar //
				///////////////
	

function SKIN:PaintScrollBarGrip( panel )

	local w, h 	= panel:GetSize()
	local x, y 	= panel:GetPos()
	local outline	 = self.shadow
	local glow	 = self.control_glowoff

	self:DrawGenericBackground( 0, 0, w, h, self.colPropertySheet )
		
	for i=0, 5 do

		surface.SetDrawColor( glow.r, glow.g, glow.b, glow.a/i )
		surface.DrawOutlinedRect( i, i, w-(i*2), h-(i*2) )
	end
		
	surface.SetDrawColor( outline.r, outline.g, outline.b, 255 )
	surface.DrawOutlinedRect( 0, 0, w, h)
	
end



				///////////
				// dTree //
				///////////

function SKIN:PaintTree( panel )

	local w, h	 = panel:GetSize()
	local x, y 	 = panel:GetPos()

	if ( panel.m_bBackground ) then
		surface.SetDrawColor( self.bg_color_bright.r, self.bg_color_bright.g, self.bg_color_bright.b, self.bg_color_bright.a )
		panel:DrawFilledRect()

		surface.SetDrawColor( 255, 255, 255, 128 )
		surface.DrawRect( w+1, 1, 1, h-2 )
		surface.DrawRect( 1, h+1, w-2, 1 )
		surface.SetDrawColor( 0, 0, 0, 0 )
		surface.DrawRect( 1, 1, w-2, 1)
		surface.DrawRect( 1, 1, 1, h-2)
	end

end
derma.DefineSkin( "Vista", "copyright Microsoft", SKIN )